<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Navo Portable Library: navo/algorithm/crypto/symmetric/blowfish.c源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- 制作者 Doxygen 1.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Navo Portable Library&#160;<span id="projectnumber">Ver 1.0.20120827</span></div>
   <div id="projectbrief">Provides generic platform independent facilities.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>数据结构</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
      <li><a href="globals.html"><span>全局定义</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>navo/algorithm/crypto/symmetric/blowfish.c</h1>  </div>
</div>
<div class="contents">
<a href="blowfish_8c.html">浏览该文件的文档。</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</span>
<a name="l00011"></a>00011 <span class="preprocessor">#ifdef _MSC_VER</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#pragma optimize(&quot;t&quot;, on)</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="preprocessor">#endif  </span><span class="comment">/* #ifdef _MSC_VER */</span>
<a name="l00014"></a>00014 
<a name="l00015"></a>00015 <span class="preprocessor">#include &quot;<a class="code" href="blowfish_8h.html" title="Blowfish.">blowfish.h</a>&quot;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &quot;<a class="code" href="endian_8h.html" title="Definitions for byte order.">../../../port/endian.h</a>&quot;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00020"></a>00020 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="keyword">static</span> <span class="keyword">const</span> uint32_t PB[18] = {
<a name="l00023"></a>00023     0x243f6a88UL, 0x85a308d3UL, 0x13198a2eUL, 0x03707344UL,
<a name="l00024"></a>00024     0xa4093822UL, 0x299f31d0UL, 0x082efa98UL, 0xec4e6c89UL,
<a name="l00025"></a>00025     0x452821e6UL, 0x38d01377UL, 0xbe5466cfUL, 0x34e90c6cUL,
<a name="l00026"></a>00026     0xc0ac29b7UL, 0xc97c50ddUL, 0x3f84d5b5UL, 0xb5470917UL,
<a name="l00027"></a>00027     0x9216d5d9UL, 0x8979fb1bUL,
<a name="l00028"></a>00028 };
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">static</span> <span class="keyword">const</span> uint32_t SB[1024] = {
<a name="l00031"></a>00031     0xd1310ba6UL, 0x98dfb5acUL, 0x2ffd72dbUL, 0xd01adfb7UL,
<a name="l00032"></a>00032     0xb8e1afedUL, 0x6a267e96UL, 0xba7c9045UL, 0xf12c7f99UL,
<a name="l00033"></a>00033     0x24a19947UL, 0xb3916cf7UL, 0x0801f2e2UL, 0x858efc16UL,
<a name="l00034"></a>00034     0x636920d8UL, 0x71574e69UL, 0xa458fea3UL, 0xf4933d7eUL,
<a name="l00035"></a>00035     0x0d95748fUL, 0x728eb658UL, 0x718bcd58UL, 0x82154aeeUL,
<a name="l00036"></a>00036     0x7b54a41dUL, 0xc25a59b5UL, 0x9c30d539UL, 0x2af26013UL,
<a name="l00037"></a>00037     0xc5d1b023UL, 0x286085f0UL, 0xca417918UL, 0xb8db38efUL,
<a name="l00038"></a>00038     0x8e79dcb0UL, 0x603a180eUL, 0x6c9e0e8bUL, 0xb01e8a3eUL,
<a name="l00039"></a>00039     0xd71577c1UL, 0xbd314b27UL, 0x78af2fdaUL, 0x55605c60UL,
<a name="l00040"></a>00040     0xe65525f3UL, 0xaa55ab94UL, 0x57489862UL, 0x63e81440UL,
<a name="l00041"></a>00041     0x55ca396aUL, 0x2aab10b6UL, 0xb4cc5c34UL, 0x1141e8ceUL,
<a name="l00042"></a>00042     0xa15486afUL, 0x7c72e993UL, 0xb3ee1411UL, 0x636fbc2aUL,
<a name="l00043"></a>00043     0x2ba9c55dUL, 0x741831f6UL, 0xce5c3e16UL, 0x9b87931eUL,
<a name="l00044"></a>00044     0xafd6ba33UL, 0x6c24cf5cUL, 0x7a325381UL, 0x28958677UL,
<a name="l00045"></a>00045     0x3b8f4898UL, 0x6b4bb9afUL, 0xc4bfe81bUL, 0x66282193UL,
<a name="l00046"></a>00046     0x61d809ccUL, 0xfb21a991UL, 0x487cac60UL, 0x5dec8032UL,
<a name="l00047"></a>00047     0xef845d5dUL, 0xe98575b1UL, 0xdc262302UL, 0xeb651b88UL,
<a name="l00048"></a>00048     0x23893e81UL, 0xd396acc5UL, 0x0f6d6ff3UL, 0x83f44239UL,
<a name="l00049"></a>00049     0x2e0b4482UL, 0xa4842004UL, 0x69c8f04aUL, 0x9e1f9b5eUL,
<a name="l00050"></a>00050     0x21c66842UL, 0xf6e96c9aUL, 0x670c9c61UL, 0xabd388f0UL,
<a name="l00051"></a>00051     0x6a51a0d2UL, 0xd8542f68UL, 0x960fa728UL, 0xab5133a3UL,
<a name="l00052"></a>00052     0x6eef0b6cUL, 0x137a3be4UL, 0xba3bf050UL, 0x7efb2a98UL,
<a name="l00053"></a>00053     0xa1f1651dUL, 0x39af0176UL, 0x66ca593eUL, 0x82430e88UL,
<a name="l00054"></a>00054     0x8cee8619UL, 0x456f9fb4UL, 0x7d84a5c3UL, 0x3b8b5ebeUL,
<a name="l00055"></a>00055     0xe06f75d8UL, 0x85c12073UL, 0x401a449fUL, 0x56c16aa6UL,
<a name="l00056"></a>00056     0x4ed3aa62UL, 0x363f7706UL, 0x1bfedf72UL, 0x429b023dUL,
<a name="l00057"></a>00057     0x37d0d724UL, 0xd00a1248UL, 0xdb0fead3UL, 0x49f1c09bUL,
<a name="l00058"></a>00058     0x075372c9UL, 0x80991b7bUL, 0x25d479d8UL, 0xf6e8def7UL,
<a name="l00059"></a>00059     0xe3fe501aUL, 0xb6794c3bUL, 0x976ce0bdUL, 0x04c006baUL,
<a name="l00060"></a>00060     0xc1a94fb6UL, 0x409f60c4UL, 0x5e5c9ec2UL, 0x196a2463UL,
<a name="l00061"></a>00061     0x68fb6fafUL, 0x3e6c53b5UL, 0x1339b2ebUL, 0x3b52ec6fUL,
<a name="l00062"></a>00062     0x6dfc511fUL, 0x9b30952cUL, 0xcc814544UL, 0xaf5ebd09UL,
<a name="l00063"></a>00063     0xbee3d004UL, 0xde334afdUL, 0x660f2807UL, 0x192e4bb3UL,
<a name="l00064"></a>00064     0xc0cba857UL, 0x45c8740fUL, 0xd20b5f39UL, 0xb9d3fbdbUL,
<a name="l00065"></a>00065     0x5579c0bdUL, 0x1a60320aUL, 0xd6a100c6UL, 0x402c7279UL,
<a name="l00066"></a>00066     0x679f25feUL, 0xfb1fa3ccUL, 0x8ea5e9f8UL, 0xdb3222f8UL,
<a name="l00067"></a>00067     0x3c7516dfUL, 0xfd616b15UL, 0x2f501ec8UL, 0xad0552abUL,
<a name="l00068"></a>00068     0x323db5faUL, 0xfd238760UL, 0x53317b48UL, 0x3e00df82UL,
<a name="l00069"></a>00069     0x9e5c57bbUL, 0xca6f8ca0UL, 0x1a87562eUL, 0xdf1769dbUL,
<a name="l00070"></a>00070     0xd542a8f6UL, 0x287effc3UL, 0xac6732c6UL, 0x8c4f5573UL,
<a name="l00071"></a>00071     0x695b27b0UL, 0xbbca58c8UL, 0xe1ffa35dUL, 0xb8f011a0UL,
<a name="l00072"></a>00072     0x10fa3d98UL, 0xfd2183b8UL, 0x4afcb56cUL, 0x2dd1d35bUL,
<a name="l00073"></a>00073     0x9a53e479UL, 0xb6f84565UL, 0xd28e49bcUL, 0x4bfb9790UL,
<a name="l00074"></a>00074     0xe1ddf2daUL, 0xa4cb7e33UL, 0x62fb1341UL, 0xcee4c6e8UL,
<a name="l00075"></a>00075     0xef20cadaUL, 0x36774c01UL, 0xd07e9efeUL, 0x2bf11fb4UL,
<a name="l00076"></a>00076     0x95dbda4dUL, 0xae909198UL, 0xeaad8e71UL, 0x6b93d5a0UL,
<a name="l00077"></a>00077     0xd08ed1d0UL, 0xafc725e0UL, 0x8e3c5b2fUL, 0x8e7594b7UL,
<a name="l00078"></a>00078     0x8ff6e2fbUL, 0xf2122b64UL, 0x8888b812UL, 0x900df01cUL,
<a name="l00079"></a>00079     0x4fad5ea0UL, 0x688fc31cUL, 0xd1cff191UL, 0xb3a8c1adUL,
<a name="l00080"></a>00080     0x2f2f2218UL, 0xbe0e1777UL, 0xea752dfeUL, 0x8b021fa1UL,
<a name="l00081"></a>00081     0xe5a0cc0fUL, 0xb56f74e8UL, 0x18acf3d6UL, 0xce89e299UL,
<a name="l00082"></a>00082     0xb4a84fe0UL, 0xfd13e0b7UL, 0x7cc43b81UL, 0xd2ada8d9UL,
<a name="l00083"></a>00083     0x165fa266UL, 0x80957705UL, 0x93cc7314UL, 0x211a1477UL,
<a name="l00084"></a>00084     0xe6ad2065UL, 0x77b5fa86UL, 0xc75442f5UL, 0xfb9d35cfUL,
<a name="l00085"></a>00085     0xebcdaf0cUL, 0x7b3e89a0UL, 0xd6411bd3UL, 0xae1e7e49UL,
<a name="l00086"></a>00086     0x00250e2dUL, 0x2071b35eUL, 0x226800bbUL, 0x57b8e0afUL,
<a name="l00087"></a>00087     0x2464369bUL, 0xf009b91eUL, 0x5563911dUL, 0x59dfa6aaUL,
<a name="l00088"></a>00088     0x78c14389UL, 0xd95a537fUL, 0x207d5ba2UL, 0x02e5b9c5UL,
<a name="l00089"></a>00089     0x83260376UL, 0x6295cfa9UL, 0x11c81968UL, 0x4e734a41UL,
<a name="l00090"></a>00090     0xb3472dcaUL, 0x7b14a94aUL, 0x1b510052UL, 0x9a532915UL,
<a name="l00091"></a>00091     0xd60f573fUL, 0xbc9bc6e4UL, 0x2b60a476UL, 0x81e67400UL,
<a name="l00092"></a>00092     0x08ba6fb5UL, 0x571be91fUL, 0xf296ec6bUL, 0x2a0dd915UL,
<a name="l00093"></a>00093     0xb6636521UL, 0xe7b9f9b6UL, 0xff34052eUL, 0xc5855664UL,
<a name="l00094"></a>00094     0x53b02d5dUL, 0xa99f8fa1UL, 0x08ba4799UL, 0x6e85076aUL,
<a name="l00095"></a>00095     0x4b7a70e9UL, 0xb5b32944UL, 0xdb75092eUL, 0xc4192623UL,
<a name="l00096"></a>00096     0xad6ea6b0UL, 0x49a7df7dUL, 0x9cee60b8UL, 0x8fedb266UL,
<a name="l00097"></a>00097     0xecaa8c71UL, 0x699a17ffUL, 0x5664526cUL, 0xc2b19ee1UL,
<a name="l00098"></a>00098     0x193602a5UL, 0x75094c29UL, 0xa0591340UL, 0xe4183a3eUL,
<a name="l00099"></a>00099     0x3f54989aUL, 0x5b429d65UL, 0x6b8fe4d6UL, 0x99f73fd6UL,
<a name="l00100"></a>00100     0xa1d29c07UL, 0xefe830f5UL, 0x4d2d38e6UL, 0xf0255dc1UL,
<a name="l00101"></a>00101     0x4cdd2086UL, 0x8470eb26UL, 0x6382e9c6UL, 0x021ecc5eUL,
<a name="l00102"></a>00102     0x09686b3fUL, 0x3ebaefc9UL, 0x3c971814UL, 0x6b6a70a1UL,
<a name="l00103"></a>00103     0x687f3584UL, 0x52a0e286UL, 0xb79c5305UL, 0xaa500737UL,
<a name="l00104"></a>00104     0x3e07841cUL, 0x7fdeae5cUL, 0x8e7d44ecUL, 0x5716f2b8UL,
<a name="l00105"></a>00105     0xb03ada37UL, 0xf0500c0dUL, 0xf01c1f04UL, 0x0200b3ffUL,
<a name="l00106"></a>00106     0xae0cf51aUL, 0x3cb574b2UL, 0x25837a58UL, 0xdc0921bdUL,
<a name="l00107"></a>00107     0xd19113f9UL, 0x7ca92ff6UL, 0x94324773UL, 0x22f54701UL,
<a name="l00108"></a>00108     0x3ae5e581UL, 0x37c2dadcUL, 0xc8b57634UL, 0x9af3dda7UL,
<a name="l00109"></a>00109     0xa9446146UL, 0x0fd0030eUL, 0xecc8c73eUL, 0xa4751e41UL,
<a name="l00110"></a>00110     0xe238cd99UL, 0x3bea0e2fUL, 0x3280bba1UL, 0x183eb331UL,
<a name="l00111"></a>00111     0x4e548b38UL, 0x4f6db908UL, 0x6f420d03UL, 0xf60a04bfUL,
<a name="l00112"></a>00112     0x2cb81290UL, 0x24977c79UL, 0x5679b072UL, 0xbcaf89afUL,
<a name="l00113"></a>00113     0xde9a771fUL, 0xd9930810UL, 0xb38bae12UL, 0xdccf3f2eUL,
<a name="l00114"></a>00114     0x5512721fUL, 0x2e6b7124UL, 0x501adde6UL, 0x9f84cd87UL,
<a name="l00115"></a>00115     0x7a584718UL, 0x7408da17UL, 0xbc9f9abcUL, 0xe94b7d8cUL,
<a name="l00116"></a>00116     0xec7aec3aUL, 0xdb851dfaUL, 0x63094366UL, 0xc464c3d2UL,
<a name="l00117"></a>00117     0xef1c1847UL, 0x3215d908UL, 0xdd433b37UL, 0x24c2ba16UL,
<a name="l00118"></a>00118     0x12a14d43UL, 0x2a65c451UL, 0x50940002UL, 0x133ae4ddUL,
<a name="l00119"></a>00119     0x71dff89eUL, 0x10314e55UL, 0x81ac77d6UL, 0x5f11199bUL,
<a name="l00120"></a>00120     0x043556f1UL, 0xd7a3c76bUL, 0x3c11183bUL, 0x5924a509UL,
<a name="l00121"></a>00121     0xf28fe6edUL, 0x97f1fbfaUL, 0x9ebabf2cUL, 0x1e153c6eUL,
<a name="l00122"></a>00122     0x86e34570UL, 0xeae96fb1UL, 0x860e5e0aUL, 0x5a3e2ab3UL,
<a name="l00123"></a>00123     0x771fe71cUL, 0x4e3d06faUL, 0x2965dcb9UL, 0x99e71d0fUL,
<a name="l00124"></a>00124     0x803e89d6UL, 0x5266c825UL, 0x2e4cc978UL, 0x9c10b36aUL,
<a name="l00125"></a>00125     0xc6150ebaUL, 0x94e2ea78UL, 0xa5fc3c53UL, 0x1e0a2df4UL,
<a name="l00126"></a>00126     0xf2f74ea7UL, 0x361d2b3dUL, 0x1939260fUL, 0x19c27960UL,
<a name="l00127"></a>00127     0x5223a708UL, 0xf71312b6UL, 0xebadfe6eUL, 0xeac31f66UL,
<a name="l00128"></a>00128     0xe3bc4595UL, 0xa67bc883UL, 0xb17f37d1UL, 0x018cff28UL,
<a name="l00129"></a>00129     0xc332ddefUL, 0xbe6c5aa5UL, 0x65582185UL, 0x68ab9802UL,
<a name="l00130"></a>00130     0xeecea50fUL, 0xdb2f953bUL, 0x2aef7dadUL, 0x5b6e2f84UL,
<a name="l00131"></a>00131     0x1521b628UL, 0x29076170UL, 0xecdd4775UL, 0x619f1510UL,
<a name="l00132"></a>00132     0x13cca830UL, 0xeb61bd96UL, 0x0334fe1eUL, 0xaa0363cfUL,
<a name="l00133"></a>00133     0xb5735c90UL, 0x4c70a239UL, 0xd59e9e0bUL, 0xcbaade14UL,
<a name="l00134"></a>00134     0xeecc86bcUL, 0x60622ca7UL, 0x9cab5cabUL, 0xb2f3846eUL,
<a name="l00135"></a>00135     0x648b1eafUL, 0x19bdf0caUL, 0xa02369b9UL, 0x655abb50UL,
<a name="l00136"></a>00136     0x40685a32UL, 0x3c2ab4b3UL, 0x319ee9d5UL, 0xc021b8f7UL,
<a name="l00137"></a>00137     0x9b540b19UL, 0x875fa099UL, 0x95f7997eUL, 0x623d7da8UL,
<a name="l00138"></a>00138     0xf837889aUL, 0x97e32d77UL, 0x11ed935fUL, 0x16681281UL,
<a name="l00139"></a>00139     0x0e358829UL, 0xc7e61fd6UL, 0x96dedfa1UL, 0x7858ba99UL,
<a name="l00140"></a>00140     0x57f584a5UL, 0x1b227263UL, 0x9b83c3ffUL, 0x1ac24696UL,
<a name="l00141"></a>00141     0xcdb30aebUL, 0x532e3054UL, 0x8fd948e4UL, 0x6dbc3128UL,
<a name="l00142"></a>00142     0x58ebf2efUL, 0x34c6ffeaUL, 0xfe28ed61UL, 0xee7c3c73UL,
<a name="l00143"></a>00143     0x5d4a14d9UL, 0xe864b7e3UL, 0x42105d14UL, 0x203e13e0UL,
<a name="l00144"></a>00144     0x45eee2b6UL, 0xa3aaabeaUL, 0xdb6c4f15UL, 0xfacb4fd0UL,
<a name="l00145"></a>00145     0xc742f442UL, 0xef6abbb5UL, 0x654f3b1dUL, 0x41cd2105UL,
<a name="l00146"></a>00146     0xd81e799eUL, 0x86854dc7UL, 0xe44b476aUL, 0x3d816250UL,
<a name="l00147"></a>00147     0xcf62a1f2UL, 0x5b8d2646UL, 0xfc8883a0UL, 0xc1c7b6a3UL,
<a name="l00148"></a>00148     0x7f1524c3UL, 0x69cb7492UL, 0x47848a0bUL, 0x5692b285UL,
<a name="l00149"></a>00149     0x095bbf00UL, 0xad19489dUL, 0x1462b174UL, 0x23820e00UL,
<a name="l00150"></a>00150     0x58428d2aUL, 0x0c55f5eaUL, 0x1dadf43eUL, 0x233f7061UL,
<a name="l00151"></a>00151     0x3372f092UL, 0x8d937e41UL, 0xd65fecf1UL, 0x6c223bdbUL,
<a name="l00152"></a>00152     0x7cde3759UL, 0xcbee7460UL, 0x4085f2a7UL, 0xce77326eUL,
<a name="l00153"></a>00153     0xa6078084UL, 0x19f8509eUL, 0xe8efd855UL, 0x61d99735UL,
<a name="l00154"></a>00154     0xa969a7aaUL, 0xc50c06c2UL, 0x5a04abfcUL, 0x800bcadcUL,
<a name="l00155"></a>00155     0x9e447a2eUL, 0xc3453484UL, 0xfdd56705UL, 0x0e1e9ec9UL,
<a name="l00156"></a>00156     0xdb73dbd3UL, 0x105588cdUL, 0x675fda79UL, 0xe3674340UL,
<a name="l00157"></a>00157     0xc5c43465UL, 0x713e38d8UL, 0x3d28f89eUL, 0xf16dff20UL,
<a name="l00158"></a>00158     0x153e21e7UL, 0x8fb03d4aUL, 0xe6e39f2bUL, 0xdb83adf7UL,
<a name="l00159"></a>00159     0xe93d5a68UL, 0x948140f7UL, 0xf64c261cUL, 0x94692934UL,
<a name="l00160"></a>00160     0x411520f7UL, 0x7602d4f7UL, 0xbcf46b2eUL, 0xd4a20068UL,
<a name="l00161"></a>00161     0xd4082471UL, 0x3320f46aUL, 0x43b7d4b7UL, 0x500061afUL,
<a name="l00162"></a>00162     0x1e39f62eUL, 0x97244546UL, 0x14214f74UL, 0xbf8b8840UL,
<a name="l00163"></a>00163     0x4d95fc1dUL, 0x96b591afUL, 0x70f4ddd3UL, 0x66a02f45UL,
<a name="l00164"></a>00164     0xbfbc09ecUL, 0x03bd9785UL, 0x7fac6dd0UL, 0x31cb8504UL,
<a name="l00165"></a>00165     0x96eb27b3UL, 0x55fd3941UL, 0xda2547e6UL, 0xabca0a9aUL,
<a name="l00166"></a>00166     0x28507825UL, 0x530429f4UL, 0x0a2c86daUL, 0xe9b66dfbUL,
<a name="l00167"></a>00167     0x68dc1462UL, 0xd7486900UL, 0x680ec0a4UL, 0x27a18deeUL,
<a name="l00168"></a>00168     0x4f3ffea2UL, 0xe887ad8cUL, 0xb58ce006UL, 0x7af4d6b6UL,
<a name="l00169"></a>00169     0xaace1e7cUL, 0xd3375fecUL, 0xce78a399UL, 0x406b2a42UL,
<a name="l00170"></a>00170     0x20fe9e35UL, 0xd9f385b9UL, 0xee39d7abUL, 0x3b124e8bUL,
<a name="l00171"></a>00171     0x1dc9faf7UL, 0x4b6d1856UL, 0x26a36631UL, 0xeae397b2UL,
<a name="l00172"></a>00172     0x3a6efa74UL, 0xdd5b4332UL, 0x6841e7f7UL, 0xca7820fbUL,
<a name="l00173"></a>00173     0xfb0af54eUL, 0xd8feb397UL, 0x454056acUL, 0xba489527UL,
<a name="l00174"></a>00174     0x55533a3aUL, 0x20838d87UL, 0xfe6ba9b7UL, 0xd096954bUL,
<a name="l00175"></a>00175     0x55a867bcUL, 0xa1159a58UL, 0xcca92963UL, 0x99e1db33UL,
<a name="l00176"></a>00176     0xa62a4a56UL, 0x3f3125f9UL, 0x5ef47e1cUL, 0x9029317cUL,
<a name="l00177"></a>00177     0xfdf8e802UL, 0x04272f70UL, 0x80bb155cUL, 0x05282ce3UL,
<a name="l00178"></a>00178     0x95c11548UL, 0xe4c66d22UL, 0x48c1133fUL, 0xc70f86dcUL,
<a name="l00179"></a>00179     0x07f9c9eeUL, 0x41041f0fUL, 0x404779a4UL, 0x5d886e17UL,
<a name="l00180"></a>00180     0x325f51ebUL, 0xd59bc0d1UL, 0xf2bcc18fUL, 0x41113564UL,
<a name="l00181"></a>00181     0x257b7834UL, 0x602a9c60UL, 0xdff8e8a3UL, 0x1f636c1bUL,
<a name="l00182"></a>00182     0x0e12b4c2UL, 0x02e1329eUL, 0xaf664fd1UL, 0xcad18115UL,
<a name="l00183"></a>00183     0x6b2395e0UL, 0x333e92e1UL, 0x3b240b62UL, 0xeebeb922UL,
<a name="l00184"></a>00184     0x85b2a20eUL, 0xe6ba0d99UL, 0xde720c8cUL, 0x2da2f728UL,
<a name="l00185"></a>00185     0xd0127845UL, 0x95b794fdUL, 0x647d0862UL, 0xe7ccf5f0UL,
<a name="l00186"></a>00186     0x5449a36fUL, 0x877d48faUL, 0xc39dfd27UL, 0xf33e8d1eUL,
<a name="l00187"></a>00187     0x0a476341UL, 0x992eff74UL, 0x3a6f6eabUL, 0xf4f8fd37UL,
<a name="l00188"></a>00188     0xa812dc60UL, 0xa1ebddf8UL, 0x991be14cUL, 0xdb6e6b0dUL,
<a name="l00189"></a>00189     0xc67b5510UL, 0x6d672c37UL, 0x2765d43bUL, 0xdcd0e804UL,
<a name="l00190"></a>00190     0xf1290dc7UL, 0xcc00ffa3UL, 0xb5390f92UL, 0x690fed0bUL,
<a name="l00191"></a>00191     0x667b9ffbUL, 0xcedb7d9cUL, 0xa091cf0bUL, 0xd9155ea3UL,
<a name="l00192"></a>00192     0xbb132f88UL, 0x515bad24UL, 0x7b9479bfUL, 0x763bd6ebUL,
<a name="l00193"></a>00193     0x37392eb3UL, 0xcc115979UL, 0x8026e297UL, 0xf42e312dUL,
<a name="l00194"></a>00194     0x6842ada7UL, 0xc66a2b3bUL, 0x12754cccUL, 0x782ef11cUL,
<a name="l00195"></a>00195     0x6a124237UL, 0xb79251e7UL, 0x06a1bbe6UL, 0x4bfb6350UL,
<a name="l00196"></a>00196     0x1a6b1018UL, 0x11caedfaUL, 0x3d25bdd8UL, 0xe2e1c3c9UL,
<a name="l00197"></a>00197     0x44421659UL, 0x0a121386UL, 0xd90cec6eUL, 0xd5abea2aUL,
<a name="l00198"></a>00198     0x64af674eUL, 0xda86a85fUL, 0xbebfe988UL, 0x64e4c3feUL,
<a name="l00199"></a>00199     0x9dbc8057UL, 0xf0f7c086UL, 0x60787bf8UL, 0x6003604dUL,
<a name="l00200"></a>00200     0xd1fd8346UL, 0xf6381fb0UL, 0x7745ae04UL, 0xd736fcccUL,
<a name="l00201"></a>00201     0x83426b33UL, 0xf01eab71UL, 0xb0804187UL, 0x3c005e5fUL,
<a name="l00202"></a>00202     0x77a057beUL, 0xbde8ae24UL, 0x55464299UL, 0xbf582e61UL,
<a name="l00203"></a>00203     0x4e58f48fUL, 0xf2ddfda2UL, 0xf474ef38UL, 0x8789bdc2UL,
<a name="l00204"></a>00204     0x5366f9c3UL, 0xc8b38e74UL, 0xb475f255UL, 0x46fcd9b9UL,
<a name="l00205"></a>00205     0x7aeb2661UL, 0x8b1ddf84UL, 0x846a0e79UL, 0x915f95e2UL,
<a name="l00206"></a>00206     0x466e598eUL, 0x20b45770UL, 0x8cd55591UL, 0xc902de4cUL,
<a name="l00207"></a>00207     0xb90bace1UL, 0xbb8205d0UL, 0x11a86248UL, 0x7574a99eUL,
<a name="l00208"></a>00208     0xb77f19b6UL, 0xe0a9dc09UL, 0x662d09a1UL, 0xc4324633UL,
<a name="l00209"></a>00209     0xe85a1f02UL, 0x09f0be8cUL, 0x4a99a025UL, 0x1d6efe10UL,
<a name="l00210"></a>00210     0x1ab93d1dUL, 0x0ba5a4dfUL, 0xa186f20fUL, 0x2868f169UL,
<a name="l00211"></a>00211     0xdcb7da83UL, 0x573906feUL, 0xa1e2ce9bUL, 0x4fcd7f52UL,
<a name="l00212"></a>00212     0x50115e01UL, 0xa70683faUL, 0xa002b5c4UL, 0x0de6d027UL,
<a name="l00213"></a>00213     0x9af88c27UL, 0x773f8641UL, 0xc3604c06UL, 0x61a806b5UL,
<a name="l00214"></a>00214     0xf0177a28UL, 0xc0f586e0UL, 0x006058aaUL, 0x30dc7d62UL,
<a name="l00215"></a>00215     0x11e69ed7UL, 0x2338ea63UL, 0x53c2dd94UL, 0xc2c21634UL,
<a name="l00216"></a>00216     0xbbcbee56UL, 0x90bcb6deUL, 0xebfc7da1UL, 0xce591d76UL,
<a name="l00217"></a>00217     0x6f05e409UL, 0x4b7c0188UL, 0x39720a3dUL, 0x7c927c24UL,
<a name="l00218"></a>00218     0x86e3725fUL, 0x724d9db9UL, 0x1ac15bb4UL, 0xd39eb8fcUL,
<a name="l00219"></a>00219     0xed545578UL, 0x08fca5b5UL, 0xd83d7cd3UL, 0x4dad0fc4UL,
<a name="l00220"></a>00220     0x1e50ef5eUL, 0xb161e6f8UL, 0xa28514d9UL, 0x6c51133cUL,
<a name="l00221"></a>00221     0x6fd5c7e7UL, 0x56e14ec4UL, 0x362abfceUL, 0xddc6c837UL,
<a name="l00222"></a>00222     0xd79a3234UL, 0x92638212UL, 0x670efa8eUL, 0x406000e0UL,
<a name="l00223"></a>00223     0x3a39ce37UL, 0xd3faf5cfUL, 0xabc27737UL, 0x5ac52d1bUL,
<a name="l00224"></a>00224     0x5cb0679eUL, 0x4fa33742UL, 0xd3822740UL, 0x99bc9bbeUL,
<a name="l00225"></a>00225     0xd5118e9dUL, 0xbf0f7315UL, 0xd62d1c7eUL, 0xc700c47bUL,
<a name="l00226"></a>00226     0xb78c1b6bUL, 0x21a19045UL, 0xb26eb1beUL, 0x6a366eb4UL,
<a name="l00227"></a>00227     0x5748ab2fUL, 0xbc946e79UL, 0xc6a376d2UL, 0x6549c2c8UL,
<a name="l00228"></a>00228     0x530ff8eeUL, 0x468dde7dUL, 0xd5730a1dUL, 0x4cd04dc6UL,
<a name="l00229"></a>00229     0x2939bbdbUL, 0xa9ba4650UL, 0xac9526e8UL, 0xbe5ee304UL,
<a name="l00230"></a>00230     0xa1fad5f0UL, 0x6a2d519aUL, 0x63ef8ce2UL, 0x9a86ee22UL,
<a name="l00231"></a>00231     0xc089c2b8UL, 0x43242ef6UL, 0xa51e03aaUL, 0x9cf2d0a4UL,
<a name="l00232"></a>00232     0x83c061baUL, 0x9be96a4dUL, 0x8fe51550UL, 0xba645bd6UL,
<a name="l00233"></a>00233     0x2826a2f9UL, 0xa73a3ae1UL, 0x4ba99586UL, 0xef5562e9UL,
<a name="l00234"></a>00234     0xc72fefd3UL, 0xf752f7daUL, 0x3f046f69UL, 0x77fa0a59UL,
<a name="l00235"></a>00235     0x80e4a915UL, 0x87b08601UL, 0x9b09e6adUL, 0x3b3ee593UL,
<a name="l00236"></a>00236     0xe990fd5aUL, 0x9e34d797UL, 0x2cf0b7d9UL, 0x022b8b51UL,
<a name="l00237"></a>00237     0x96d5ac3aUL, 0x017da67dUL, 0xd1cf3ed6UL, 0x7c7d2d28UL,
<a name="l00238"></a>00238     0x1f9f25cfUL, 0xadf2b89bUL, 0x5ad6b472UL, 0x5a88f54cUL,
<a name="l00239"></a>00239     0xe029ac71UL, 0xe019a5e6UL, 0x47b0acfdUL, 0xed93fa9bUL,
<a name="l00240"></a>00240     0xe8d3c48dUL, 0x283b57ccUL, 0xf8d56629UL, 0x79132e28UL,
<a name="l00241"></a>00241     0x785f0191UL, 0xed756055UL, 0xf7960e44UL, 0xe3d35e8cUL,
<a name="l00242"></a>00242     0x15056dd4UL, 0x88f46dbaUL, 0x03a16125UL, 0x0564f0bdUL,
<a name="l00243"></a>00243     0xc3eb9e15UL, 0x3c9057a2UL, 0x97271aecUL, 0xa93a072aUL,
<a name="l00244"></a>00244     0x1b3f6d9bUL, 0x1e6321f5UL, 0xf59c66fbUL, 0x26dcf319UL,
<a name="l00245"></a>00245     0x7533d928UL, 0xb155fdf5UL, 0x03563482UL, 0x8aba3cbbUL,
<a name="l00246"></a>00246     0x28517711UL, 0xc20ad9f8UL, 0xabcc5167UL, 0xccad925fUL,
<a name="l00247"></a>00247     0x4de81751UL, 0x3830dc8eUL, 0x379d5862UL, 0x9320f991UL,
<a name="l00248"></a>00248     0xea7a90c2UL, 0xfb3e7bceUL, 0x5121ce64UL, 0x774fbe32UL,
<a name="l00249"></a>00249     0xa8b6e37eUL, 0xc3293d46UL, 0x48de5369UL, 0x6413e680UL,
<a name="l00250"></a>00250     0xa2ae0810UL, 0xdd6db224UL, 0x69852dfdUL, 0x09072166UL,
<a name="l00251"></a>00251     0xb39a460aUL, 0x6445c0ddUL, 0x586cdecfUL, 0x1c20c8aeUL,
<a name="l00252"></a>00252     0x5bbef7ddUL, 0x1b588d40UL, 0xccd2017fUL, 0x6bb4e3bbUL,
<a name="l00253"></a>00253     0xdda26a7eUL, 0x3a59ff45UL, 0x3e350a44UL, 0xbcb4cdd5UL,
<a name="l00254"></a>00254     0x72eacea8UL, 0xfa6484bbUL, 0x8d6612aeUL, 0xbf3c6f47UL,
<a name="l00255"></a>00255     0xd29be463UL, 0x542f5d9eUL, 0xaec2771bUL, 0xf64e6370UL,
<a name="l00256"></a>00256     0x740e0d8dUL, 0xe75b1357UL, 0xf8721671UL, 0xaf537d5dUL,
<a name="l00257"></a>00257     0x4040cb08UL, 0x4eb4e2ccUL, 0x34d2466aUL, 0x0115af84UL,
<a name="l00258"></a>00258     0xe1b00428UL, 0x95983a1dUL, 0x06b89fb4UL, 0xce6ea048UL,
<a name="l00259"></a>00259     0x6f3f3b82UL, 0x3520ab82UL, 0x011a1d4bUL, 0x277227f8UL,
<a name="l00260"></a>00260     0x611560b1UL, 0xe7933fdcUL, 0xbb3a792bUL, 0x344525bdUL,
<a name="l00261"></a>00261     0xa08839e1UL, 0x51ce794bUL, 0x2f32c9b7UL, 0xa01fbac9UL,
<a name="l00262"></a>00262     0xe01cc87eUL, 0xbcc7d1f6UL, 0xcf0111c3UL, 0xa1e8aac7UL,
<a name="l00263"></a>00263     0x1a908749UL, 0xd44fbd9aUL, 0xd0dadecbUL, 0xd50ada38UL,
<a name="l00264"></a>00264     0x0339c32aUL, 0xc6913667UL, 0x8df9317cUL, 0xe0b12b4fUL,
<a name="l00265"></a>00265     0xf79e59b7UL, 0x43f5bb3aUL, 0xf2d519ffUL, 0x27d9459cUL,
<a name="l00266"></a>00266     0xbf97222cUL, 0x15e6fc2aUL, 0x0f91fc71UL, 0x9b941525UL,
<a name="l00267"></a>00267     0xfae59361UL, 0xceb69cebUL, 0xc2a86459UL, 0x12baa8d1UL,
<a name="l00268"></a>00268     0xb6c1075eUL, 0xe3056a0cUL, 0x10d25065UL, 0xcb03a442UL,
<a name="l00269"></a>00269     0xe0ec6e0eUL, 0x1698db3bUL, 0x4c98a0beUL, 0x3278e964UL,
<a name="l00270"></a>00270     0x9f1f9532UL, 0xe0d392dfUL, 0xd3a0342bUL, 0x8971f21eUL,
<a name="l00271"></a>00271     0x1b0a7441UL, 0x4ba3348cUL, 0xc5be7120UL, 0xc37632d8UL,
<a name="l00272"></a>00272     0xdf359f8dUL, 0x9b992f2eUL, 0xe60b6f47UL, 0x0fe3f11dUL,
<a name="l00273"></a>00273     0xe54cda54UL, 0x1edad891UL, 0xce6279cfUL, 0xcd3e7e6fUL,
<a name="l00274"></a>00274     0x1618b166UL, 0xfd2c1d05UL, 0x848fd2c5UL, 0xf6fb2299UL,
<a name="l00275"></a>00275     0xf523f357UL, 0xa6327623UL, 0x93a83531UL, 0x56cccd02UL,
<a name="l00276"></a>00276     0xacf08162UL, 0x5a75ebb5UL, 0x6e163697UL, 0x88d273ccUL,
<a name="l00277"></a>00277     0xde966292UL, 0x81b949d0UL, 0x4c50901bUL, 0x71c65614UL,
<a name="l00278"></a>00278     0xe6c6c7bdUL, 0x327a140aUL, 0x45e1d006UL, 0xc3f27b9aUL,
<a name="l00279"></a>00279     0xc9aa53fdUL, 0x62a80f00UL, 0xbb25bfe2UL, 0x35bdd2f6UL,
<a name="l00280"></a>00280     0x71126905UL, 0xb2040222UL, 0xb6cbcf7cUL, 0xcd769c2bUL,
<a name="l00281"></a>00281     0x53113ec0UL, 0x1640e3d3UL, 0x38abbd60UL, 0x2547adf0UL,
<a name="l00282"></a>00282     0xba38209cUL, 0xf746ce76UL, 0x77afa1c5UL, 0x20756060UL,
<a name="l00283"></a>00283     0x85cbfe4eUL, 0x8ae88dd8UL, 0x7aaaf9b0UL, 0x4cf9aa7eUL,
<a name="l00284"></a>00284     0x1948c25cUL, 0x02fb8a8cUL, 0x01c36ae4UL, 0xd6ebe1f9UL,
<a name="l00285"></a>00285     0x90d4f869UL, 0xa65cdea0UL, 0x3f09252dUL, 0xc208e69fUL,
<a name="l00286"></a>00286     0xb74e6132UL, 0xce77e25bUL, 0x578fdfe3UL, 0x3ac372e6UL,
<a name="l00287"></a>00287 };
<a name="l00288"></a>00288 
<a name="l00289"></a>00289 <span class="preprocessor">#define GET32_3(x) ( (x)          &amp; (0xFF))</span>
<a name="l00290"></a>00290 <span class="preprocessor"></span><span class="preprocessor">#define GET32_2(x) (((x) &gt;&gt; ( 8)) &amp; (0xFF))</span>
<a name="l00291"></a>00291 <span class="preprocessor"></span><span class="preprocessor">#define GET32_1(x) (((x) &gt;&gt; (16)) &amp; (0xFF))</span>
<a name="l00292"></a>00292 <span class="preprocessor"></span><span class="preprocessor">#define GET32_0(x) (((x) &gt;&gt; (24)) &amp; (0xFF))</span>
<a name="l00293"></a>00293 <span class="preprocessor"></span>
<a name="l00294"></a>00294 <span class="preprocessor">#define F(x) \</span>
<a name="l00295"></a>00295 <span class="preprocessor">    (((s_box[GET32_0(x)      ]   + s_box[GET32_1(x) + 256]) ^ \</span>
<a name="l00296"></a>00296 <span class="preprocessor">        s_box[GET32_2(x) + 512]) + s_box[GET32_3(x) + 768])</span>
<a name="l00297"></a>00297 <span class="preprocessor"></span>
<a name="l00298"></a>00298 <span class="preprocessor">#define ROUND(a, b, n) (b) ^= esk[(n)]; (a) ^= F(b)</span>
<a name="l00299"></a>00299 <span class="preprocessor"></span>
<a name="l00300"></a>00300 <span class="preprocessor">#define CR(a, b, c) ((((a) + (b)) &gt;= (c))? ((a) + (b) - (c)): ((a) + (b)))</span>
<a name="l00301"></a>00301 <span class="preprocessor"></span>
<a name="l00302"></a>00302 <span class="keyword">static</span> <span class="keywordtype">void</span> __blowfish_encrypt_block(uint32_t* esk, uint32_t* s_box,
<a name="l00303"></a>00303                                     uint32_t* dst, uint32_t* src)
<a name="l00304"></a>00304 {
<a name="l00305"></a>00305     uint32_t yl = __be32_to_cpu(src[0]);
<a name="l00306"></a>00306     uint32_t yr = __be32_to_cpu(src[1]);
<a name="l00307"></a>00307 
<a name="l00308"></a>00308     ROUND(yr, yl, 0);
<a name="l00309"></a>00309     ROUND(yl, yr, 1);
<a name="l00310"></a>00310     ROUND(yr, yl, 2);
<a name="l00311"></a>00311     ROUND(yl, yr, 3);
<a name="l00312"></a>00312     ROUND(yr, yl, 4);
<a name="l00313"></a>00313     ROUND(yl, yr, 5);
<a name="l00314"></a>00314     ROUND(yr, yl, 6);
<a name="l00315"></a>00315     ROUND(yl, yr, 7);
<a name="l00316"></a>00316     ROUND(yr, yl, 8);
<a name="l00317"></a>00317     ROUND(yl, yr, 9);
<a name="l00318"></a>00318     ROUND(yr, yl, 10);
<a name="l00319"></a>00319     ROUND(yl, yr, 11);
<a name="l00320"></a>00320     ROUND(yr, yl, 12);
<a name="l00321"></a>00321     ROUND(yl, yr, 13);
<a name="l00322"></a>00322     ROUND(yr, yl, 14);
<a name="l00323"></a>00323     ROUND(yl, yr, 15);
<a name="l00324"></a>00324 
<a name="l00325"></a>00325     yl ^= esk[16];
<a name="l00326"></a>00326     yr ^= esk[17];
<a name="l00327"></a>00327 
<a name="l00328"></a>00328     dst[0] = __cpu_to_be32(yr);
<a name="l00329"></a>00329     dst[1] = __cpu_to_be32(yl);
<a name="l00330"></a>00330 }
<a name="l00331"></a>00331 
<a name="l00332"></a>00332 NV_IMPL <span class="keywordtype">void</span> __blowfish_set_key(<a class="code" href="structblowfish__key.html" title="Blowfish密钥">blowfish_key</a>* key,
<a name="l00333"></a>00333                             <a class="code" href="group___xE6_x95_xB4_xE5_x9E_x8B_xE5_xAE_x9A_xE4_xB9_x89.html#gae1affc9ca37cfb624959c866a73f83c2" title="8比特无符号整型">uint8_t</a>* src_key, <span class="keywordtype">size_t</span> cnt)
<a name="l00334"></a>00334 {
<a name="l00335"></a>00335     uint16_t i, j, c;
<a name="l00336"></a>00336     uint32_t *esk = key-&gt;<a class="code" href="structblowfish__key.html#a89e19019e2d0f6de43b9f0032f891e6c" title="加密钥">esk</a>;
<a name="l00337"></a>00337     uint32_t *s_box = key-&gt;<a class="code" href="structblowfish__key.html#a3cdfa759444c2034a57212fddd79ce05" title="置换盒">s</a>;
<a name="l00338"></a>00338     uint32_t dbuf[2], tmp;
<a name="l00339"></a>00339 
<a name="l00340"></a>00340     <span class="keywordflow">for</span> (i = 0, c = 0; i &lt; 256; ++i)
<a name="l00341"></a>00341         <span class="keywordflow">for</span> (j = 0; j &lt; 4; ++j, ++c)
<a name="l00342"></a>00342             s_box[c] = SB[c];
<a name="l00343"></a>00343 
<a name="l00344"></a>00344     <span class="keywordflow">for</span> (i = 0; i &lt; 18; i++)
<a name="l00345"></a>00345         esk[i] = PB[i];
<a name="l00346"></a>00346 
<a name="l00347"></a>00347     <span class="keywordflow">for</span> (j = 0, i = 0; i &lt; 18; ++i) {
<a name="l00348"></a>00348         tmp = (((uint32_t)src_key[CR(j, 0, cnt)] &lt;&lt; 24) |
<a name="l00349"></a>00349                 ((uint32_t)src_key[CR(j, 1, cnt)] &lt;&lt; 16) |
<a name="l00350"></a>00350                 ((uint32_t)src_key[CR(j, 2, cnt)] &lt;&lt;  8) |
<a name="l00351"></a>00351                 ((uint32_t)src_key[CR(j, 3, cnt)]      ));
<a name="l00352"></a>00352         esk[i] ^= tmp;
<a name="l00353"></a>00353         j = (uint16_t)CR(j, 4, cnt);
<a name="l00354"></a>00354     }
<a name="l00355"></a>00355 
<a name="l00356"></a>00356     dbuf[0] = 0;
<a name="l00357"></a>00357     dbuf[1] = 0;
<a name="l00358"></a>00358 
<a name="l00359"></a>00359     <span class="keywordflow">for</span> (i = 0; i &lt; 18; i += 2) {
<a name="l00360"></a>00360         __blowfish_encrypt_block(esk, s_box, dbuf, dbuf);
<a name="l00361"></a>00361         esk[i    ] = dbuf[0];
<a name="l00362"></a>00362         esk[i + 1] = dbuf[1];
<a name="l00363"></a>00363     }
<a name="l00364"></a>00364 
<a name="l00365"></a>00365     <span class="keywordflow">for</span> (i = 0; i &lt; 4; i++) {
<a name="l00366"></a>00366         <span class="keywordflow">for</span> (j = 0, cnt = i &lt;&lt; 8; j &lt; 256; j += 2, cnt += 2) {
<a name="l00367"></a>00367             __blowfish_encrypt_block(esk, s_box, dbuf, dbuf);
<a name="l00368"></a>00368             s_box[cnt    ] = dbuf[0];
<a name="l00369"></a>00369             s_box[cnt + 1] = dbuf[1];
<a name="l00370"></a>00370         }
<a name="l00371"></a>00371     }
<a name="l00372"></a>00372 }
<a name="l00373"></a>00373 
<a name="l00374"></a>00374 NV_IMPL <span class="keywordtype">void</span> __blowfish_encrypt(uint32_t* esk, uint32_t* s_box,
<a name="l00375"></a>00375                                 uint32_t* dst, uint32_t* src)
<a name="l00376"></a>00376 {
<a name="l00377"></a>00377     uint32_t yl = __be32_to_cpu(src[0]);
<a name="l00378"></a>00378     uint32_t yr = __be32_to_cpu(src[1]);
<a name="l00379"></a>00379 
<a name="l00380"></a>00380     ROUND(yr, yl, 0);
<a name="l00381"></a>00381     ROUND(yl, yr, 1);
<a name="l00382"></a>00382     ROUND(yr, yl, 2);
<a name="l00383"></a>00383     ROUND(yl, yr, 3);
<a name="l00384"></a>00384     ROUND(yr, yl, 4);
<a name="l00385"></a>00385     ROUND(yl, yr, 5);
<a name="l00386"></a>00386     ROUND(yr, yl, 6);
<a name="l00387"></a>00387     ROUND(yl, yr, 7);
<a name="l00388"></a>00388     ROUND(yr, yl, 8);
<a name="l00389"></a>00389     ROUND(yl, yr, 9);
<a name="l00390"></a>00390     ROUND(yr, yl, 10);
<a name="l00391"></a>00391     ROUND(yl, yr, 11);
<a name="l00392"></a>00392     ROUND(yr, yl, 12);
<a name="l00393"></a>00393     ROUND(yl, yr, 13);
<a name="l00394"></a>00394     ROUND(yr, yl, 14);
<a name="l00395"></a>00395     ROUND(yl, yr, 15);
<a name="l00396"></a>00396 
<a name="l00397"></a>00397     yl ^= esk[16];
<a name="l00398"></a>00398     yr ^= esk[17];
<a name="l00399"></a>00399 
<a name="l00400"></a>00400     dst[0] = __cpu_to_be32(yr);
<a name="l00401"></a>00401     dst[1] = __cpu_to_be32(yl);
<a name="l00402"></a>00402 }
<a name="l00403"></a>00403 
<a name="l00404"></a>00404 NV_IMPL <span class="keywordtype">void</span> __blowfish_decrypt(uint32_t* esk, uint32_t* s_box,
<a name="l00405"></a>00405                                 uint32_t* dst, uint32_t* src)
<a name="l00406"></a>00406 {
<a name="l00407"></a>00407     uint32_t yl = __be32_to_cpu(src[0]);
<a name="l00408"></a>00408     uint32_t yr = __be32_to_cpu(src[1]);
<a name="l00409"></a>00409 
<a name="l00410"></a>00410     ROUND(yr, yl, 17);
<a name="l00411"></a>00411     ROUND(yl, yr, 16);
<a name="l00412"></a>00412     ROUND(yr, yl, 15);
<a name="l00413"></a>00413     ROUND(yl, yr, 14);
<a name="l00414"></a>00414     ROUND(yr, yl, 13);
<a name="l00415"></a>00415     ROUND(yl, yr, 12);
<a name="l00416"></a>00416     ROUND(yr, yl, 11);
<a name="l00417"></a>00417     ROUND(yl, yr, 10);
<a name="l00418"></a>00418     ROUND(yr, yl, 9);
<a name="l00419"></a>00419     ROUND(yl, yr, 8);
<a name="l00420"></a>00420     ROUND(yr, yl, 7);
<a name="l00421"></a>00421     ROUND(yl, yr, 6);
<a name="l00422"></a>00422     ROUND(yr, yl, 5);
<a name="l00423"></a>00423     ROUND(yl, yr, 4);
<a name="l00424"></a>00424     ROUND(yr, yl, 3);
<a name="l00425"></a>00425     ROUND(yl, yr, 2);
<a name="l00426"></a>00426 
<a name="l00427"></a>00427     yl ^= esk[1];
<a name="l00428"></a>00428     yr ^= esk[0];
<a name="l00429"></a>00429 
<a name="l00430"></a>00430     dst[0] = __cpu_to_be32(yr);
<a name="l00431"></a>00431     dst[1] = __cpu_to_be32(yl);
<a name="l00432"></a>00432 }
<a name="l00433"></a>00433 
<a name="l00434"></a>00434 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00435"></a>00435 <span class="preprocessor"></span>}
<a name="l00436"></a>00436 <span class="preprocessor">#endif </span><span class="comment">/* #ifdef __cplusplus */</span>
<a name="l00437"></a>00437 
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>数据结构</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>文件</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>类型定义</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>宏定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generated at 2015年七月16日 星期四 12:00:37 for Navo Portable Library by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>
